﻿
@{
    ViewBag.Title = "库位定位";
}
<div style="top: 0;bottom: 0;width: 100%;position: absolute;">
    <div class="layui-show" style="width: 100% !important;height: 100% !important;">
        <iframe id='childFrame' style="width:100%;height:100%;" frameborder="0" src="@ViewBag.Url3D"></iframe>
    </div>
</div>
<script>
    function GetAction() {
        callChildFunc("receiveMainFunc", { action: "position", name:"@ViewBag.Code"});
    }

    //调用子页面函数
    function callChildFunc(funcName, data) {
        var iframe = window.frames['childFrame'];
        var message = {
            'funcName': funcName,
            'param': data
        }
        iframe.contentWindow.postMessage(message, '*');
    }
    //监听子页面调用本页面函数
    window.addEventListener('message', function (e) {
        var data = e.data;
        if (data.hasOwnProperty("funcName")) {
            var funcName = data.funcName;
            var param = data.param;
            window[funcName](param);
        }
    });
</script>
